package presenter;

import base.BasePresenter;
import base.ResultCallBack;
import bean.VideoBean;
import model.ViewModel;
import view.VideoView;

/**
 * Created by 裘翔 on 2019/11/6.
 */

public class ViewPresenter extends BasePresenter<VideoView> implements ResultCallBack<VideoBean> {
    private ViewModel viewModel;

    public ViewPresenter() {
        this.viewModel = new ViewModel();
        addModel(viewModel);
    }

    public void loadData() {
        viewModel.loadData(this);
    }

    @Override
    public void onSuccess(VideoBean videoBeans) {
        if (mView != null) {
            mView.onSuccess(videoBeans);
        }
    }

    @Override
    public void onFail(String error) {
        if (mView != null)
            mView.showToast(error);
        mView.onFailed(error);

    }

}
